package enums;

/**
 * @Description: 数据库类型枚举
 * @Author: syh
 * @Date: 2024/01/21/20:14
 */
public enum DatabaseTypeEnum {
    MYSQL("MySQL","com.mysql.jdbc.Driver"),
    ORCLE("Oracle","oracle.jdbc.driver.OracleDriver");

    private String databaseName;
    private String driverName;



    DatabaseTypeEnum(String databaseName, String driverName) {
        this.databaseName = databaseName;
        this.driverName = driverName;
    }

    public String getDatabaseName() {
        return databaseName;
    }

    public void setDatabaseName(String databaseName) {
        this.databaseName = databaseName;
    }

    public String getDriverName() {
        return driverName;
    }

    public void setDriverName(String driverName) {
        this.driverName = driverName;
    }

    public static DatabaseTypeEnum getDatabaseTypeEnum(String databaseName) {
        for (DatabaseTypeEnum databaseTypeEnum : DatabaseTypeEnum.values()) {
            if (databaseTypeEnum.getDatabaseName().equalsIgnoreCase(databaseName)) {
                return databaseTypeEnum;
            }
        }
        return null;
    }
}
